# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Participant'
        db.create_table(u'paniersApp_participant', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('nom', self.gf('django.db.models.fields.CharField')(max_length=50)),
            ('prenom', self.gf('django.db.models.fields.CharField')(max_length=50)),
            ('email', self.gf('django.db.models.fields.CharField')(max_length=50)),
            ('debut', self.gf('django.db.models.fields.DateField')()),
            ('fin', self.gf('django.db.models.fields.DateField')()),
        ))
        db.send_create_signal(u'paniersApp', ['Participant'])

        # Adding M2M table for field groupes on 'Participant'
        m2m_table_name = db.shorten_name(u'paniersApp_participant_groupes')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('participant', models.ForeignKey(orm[u'paniersApp.participant'], null=False)),
            ('group', models.ForeignKey(orm[u'paniersApp.group'], null=False))
        ))
        db.create_unique(m2m_table_name, ['participant_id', 'group_id'])

        # Adding model 'Group'
        db.create_table(u'paniersApp_group', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('nom', self.gf('django.db.models.fields.CharField')(max_length=50)),
            ('jour_de_distribution', self.gf('django.db.models.fields.IntegerField')(default=5)),
        ))
        db.send_create_signal(u'paniersApp', ['Group'])

        # Adding model 'Annee'
        db.create_table(u'paniersApp_annee', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('annee', self.gf('django.db.models.fields.IntegerField')()),
            ('debut', self.gf('django.db.models.fields.DateField')()),
            ('fin', self.gf('django.db.models.fields.DateField')()),
            ('fin_periode', self.gf('django.db.models.fields.DateField')()),
            ('nombre', self.gf('django.db.models.fields.IntegerField')()),
        ))
        db.send_create_signal(u'paniersApp', ['Annee'])

        # Adding model 'Distribution'
        db.create_table(u'paniersApp_distribution', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('date', self.gf('django.db.models.fields.DateField')()),
            ('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['paniersApp.Group'])),
            ('participant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['paniersApp.Participant'])),
        ))
        db.send_create_signal(u'paniersApp', ['Distribution'])


    def backwards(self, orm):
        # Deleting model 'Participant'
        db.delete_table(u'paniersApp_participant')

        # Removing M2M table for field groupes on 'Participant'
        db.delete_table(db.shorten_name(u'paniersApp_participant_groupes'))

        # Deleting model 'Group'
        db.delete_table(u'paniersApp_group')

        # Deleting model 'Annee'
        db.delete_table(u'paniersApp_annee')

        # Deleting model 'Distribution'
        db.delete_table(u'paniersApp_distribution')


    models = {
        u'paniersApp.annee': {
            'Meta': {'object_name': 'Annee'},
            'annee': ('django.db.models.fields.IntegerField', [], {}),
            'debut': ('django.db.models.fields.DateField', [], {}),
            'fin': ('django.db.models.fields.DateField', [], {}),
            'fin_periode': ('django.db.models.fields.DateField', [], {}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'nombre': ('django.db.models.fields.IntegerField', [], {})
        },
        u'paniersApp.distribution': {
            'Meta': {'object_name': 'Distribution'},
            'date': ('django.db.models.fields.DateField', [], {}),
            'group': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['paniersApp.Group']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'participant': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['paniersApp.Participant']"})
        },
        u'paniersApp.group': {
            'Meta': {'object_name': 'Group'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'jour_de_distribution': ('django.db.models.fields.IntegerField', [], {'default': '5'}),
            'nom': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'paniersApp.participant': {
            'Meta': {'object_name': 'Participant'},
            'debut': ('django.db.models.fields.DateField', [], {}),
            'email': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
            'fin': ('django.db.models.fields.DateField', [], {}),
            'groupes': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['paniersApp.Group']", 'symmetrical': 'False'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'nom': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
            'prenom': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        }
    }

    complete_apps = ['paniersApp']